package com.funo.wcity.app.dao;

import java.util.List;

import org.springframework.stereotype.Repository;

import com.funo.wcity.app.entity.TblUsers;
import com.funo.wcity.app.utils.StringUtil;

@Repository("tblUsersDAO")
public class TblUsersDAO extends DefaultBaseDao<TblUsers,Integer>{

	/**
	 * 查询员工关联的email列表
	 */
	public List getTblUsersList(Integer idUser,Integer idUserMail) {
		StringBuffer sql = new StringBuffer(
				"select u.idUser,m.email,m.passWord,m.pop,m.imap,m.smtp from tblUsers u,tblUserMail m where u.idUser=m.idUser ");
		if(!StringUtil.isEmpty(idUser)){
			sql.append("and  u.idUser=").append(idUser);
		}
		if(!StringUtil.isEmpty(idUserMail)){
			sql.append("and  m.idUserMail=").append(idUserMail);
		}
		sql.append(" order by u.createDate,m.lastDate");
		return this.jdbcTemplate.queryForList(sql.toString());
	}

}
